function example1 (arg1: number, arg2: number): number {
	return arg1 + arg2
}

const example2 = (arg1: number, arg2: number): number => {
	return arg1 + arg2
}

type Example3 = (arg1: number, arg2: number) => number

const example3: Example3 = (arg1, arg2) => {
	return arg1 + arg2
}

type Example4 = (arg1: number, arg2: number, arg3?: number) => number

const example4: Example4 = (arg1, arg2, arg3) => {
	return arg1 + arg2
}

interface Example5 {
	(arg1: number, arg2: number, arg3?: number): number
}

const example5 = (arg1, arg2, arg3) => {
	return arg1 + arg2
}

const example6 = (arr1, ...args: number[]) => {

}

// 函数重载	只能用function定义
function handleData(x: string): string[]
function handleData(x: number): number[]
function handleData(x: any): any {
	if( typeof x === 'string' ) {
		return x.split('')
	}else{
		return x.toString().split('').map((item) => Number(item))
	}
}

handleData('abc')
handleData(123)
